//
//  GHForTestViewModel.swift
//  GHSwiftProject
//
//  Created by Guanghui Liao on 6/11/18.
//  Copyright © 2018 liaoworking. All rights reserved.
//

import UIKit
typealias loadingSuccessDisc = (()->Void)
//首页的VM
class GHForTestViewModel: NSObject {

    var modelList:[GHForTestModel] = Array()
    
    
    /// 请求数据
    ///
    /// - Parameter success: 请求成功的回调
    func loadData(success:@escaping loadingSuccessDisc) {
        
        NetWorkRequest(.fortest) { (resultString) -> (Void) in
            
            if let items = [GHForTestModel].deserialize(from: resultString) {
                self.modelList = items as! [GHForTestModel]
                success()
            }
        }
    }
    
    
}
